package Emp;

public class HourlyEmployee extends Employee {
    private double wage;//每小时的工资
    private int time;//每月工作的小时数

    public HourlyEmployee(String name, int month, double wage, int time) {
        super(name, month);
        this.wage = wage;
        this.time = time;
    }

    public double getWage() {
        return wage;
    }

    public void setWage(double wage) {
        this.wage = wage;
    }

    public int getTime() {
        return time;
    }

    public void setTime(int time) {
        this.time = time;
    }

    public double getSalary(int month) {
        double salary = 0;
        if (time <= 160) {
            salary = wage * time;//wage 是每小时工资 , time 是工时
        } else {
            salary = ((time - 160) * (wage * 1.5)) + (160 * wage);
        }
        return salary + super.getSalary(month);
    }
}
